package offer;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Solution58_I {
    public String reverseWords(String s) {
        s = s.trim();
        if (s.length() == 0) {
            return s;
        }
        List<String> words = Arrays.asList(s.split("\\s+"));
        Collections.reverse(words);
        return String.join(" ", words);
    }
}
